package ink.yql.controller;

import ink.yql.service.LeaveaMessageService;
import ink.yql.util.RestObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author YQL
 */@RestController
@RequestMapping("/leavea_message")
public class LeaveaMessageController {

    @Autowired
    private LeaveaMessageService leaveaMessageService;
    @GetMapping("/{}/{sendTime}")
    public RestObject getByUid(@PathVariable("sendTime") Long sendTime) {
        // 保护措施  以防拿到url一直请求
        if (System.currentTimeMillis() / 1000 - sendTime > 3) {
            return RestObject.builder().code("400").message("请0求时间超时").build();
        }
        return leaveaMessageService.getByUid();
    }
}
